package com.wy.springbootblog.pojo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;

/**
 * @author work
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
@TableName("`article`")
public class Article {
    @TableId
    private Integer id;

    @NotEmpty(message = "文章标题")
    private String title;

    @NotEmpty(message = "文章描述不能为空")
    private String description;

    @NotEmpty(message = "文章内容不能为空")
    private String content;

    private Long views;

    @TableField("comment_count")
    private Integer commentCount;

    @TableField("create_time")
    private LocalDateTime createTime;

    @TableField("update_time")
    private LocalDateTime updateTime;

    @TableField("category_id")
    @NotNull(message = "分类id不能为空")
    private Integer categoryId;

    @TableField("user_id")
    private Integer userId;

    // 标记删除
    private Integer flag;

    // 非表字段
//    @TableField(exist = false)

    @NotEmpty(message = "标签id列表不能为空")
    @TableField(exist = false)
    private List<Integer> tagList;
}
